//
//  UIView+Additions.h
//  UIKit_Category
//
//  Created by Elvis on 2017/8/17.
//  Copyright © 2017年 Elvis. All rights reserved.
//

#import <UIKit/UIKit.h>

/** 比例 */
#define kScaleX [UIScreen mainScreen].bounds.size.width / 375
#define kScaleY [UIScreen mainScreen].bounds.size.height / 667

@interface UIView (Additions)

// initilization methods

+ (instancetype)ViewWithParent:(UIView *)parent;
- (instancetype)initWithParent:(UIView *)parent;

// subview
- (void)removeAllSubViews;

// view operation
- (void)setBackgroundImage:(UIImage *)image;
- (UIImage *)covertToImage;

// Position of the top-left corner in superview's coordinates
@property (assign, nonatomic) CGPoint position;
@property (assign, nonatomic) CGSize  size;
@property (assign, nonatomic) CGFloat x;
@property (assign, nonatomic) CGFloat y;
@property (assign, nonatomic) CGFloat top;
@property (assign, nonatomic) CGFloat bottom;
@property (assign, nonatomic) CGFloat left;
@property (assign, nonatomic) CGFloat right;
@property (assign, nonatomic) CGFloat width;
@property (assign, nonatomic) CGFloat height;
@property (assign, nonatomic) CGFloat centerX;
@property (assign, nonatomic) CGFloat centerY;

// view layer
@property (assign, nonatomic) CGFloat borderWidth;
@property (assign, nonatomic) CGFloat cornerRadius;
@property (strong, nonatomic) UIColor *borderColor;

// UIResponder
- (UIViewController *)parentViewController;

@end
